/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package EntityPackage;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author work
 */
@Entity
@Table(name = "location")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Location.findAll", query = "SELECT l FROM Location l"),
    @NamedQuery(name = "Location.findByIdLocation", query = "SELECT l FROM Location l WHERE l.idLocation = :idLocation"),
    @NamedQuery(name = "Location.findByIndirizzo", query = "SELECT l FROM Location l WHERE l.indirizzo = :indirizzo"),
    @NamedQuery(name = "Location.findByMaxPersone", query = "SELECT l FROM Location l WHERE l.maxPersone = :maxPersone"),
    @NamedQuery(name = "Location.findByCitta", query = "SELECT l FROM Location l WHERE l.citta = :citta"),
    @NamedQuery(name = "Location.findByTelefono", query = "SELECT l FROM Location l WHERE l.telefono = :telefono"),
    @NamedQuery(name = "Location.findByTotale", query = "SELECT l FROM Location l WHERE l.totale = :totale"),
    @NamedQuery(name = "Location.getAddress", query = "SELECT l.indirizzo FROM Location l WHERE l.idLocation = :idLocation"),
    @NamedQuery(name = "Location.getCitta", query = "SELECT l.citta FROM Location l WHERE l.idLocation = :idLocation")})
public class Location implements Serializable {
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idLocation")
    private Collection<Prenotazione> prenotazioneCollection;
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idLocation")
    private Integer idLocation;
    @Size(max = 45)
    @Column(name = "indirizzo")
    private String indirizzo;
    @Column(name = "maxPersone")
    private Integer maxPersone;
    @Size(max = 45)
    @Column(name = "citta")
    private String citta;
    @Size(max = 45)
    @Column(name = "telefono")
    private String telefono;
    @Column(name = "totale")
    private Integer totale;

    public Location() {
    }

    public Location(Integer idLocation) {
        this.idLocation = idLocation;
    }

    public Integer getIdLocation() {
        return idLocation;
    }

    public void setIdLocation(Integer idLocation) {
        this.idLocation = idLocation;
    }

    public String getIndirizzo() {
        return indirizzo;
    }

    public void setIndirizzo(String indirizzo) {
        this.indirizzo = indirizzo;
    }

    public Integer getMaxPersone() {
        return maxPersone;
    }

    public void setMaxPersone(Integer maxPersone) {
        this.maxPersone = maxPersone;
    }

    public String getCittà() {
        return citta;
    }

    public void setCittà(String città) {
        this.citta = città;
    }

    public String getTelefono() {
        return telefono;
    }

    public void setTelefono(String telefono) {
        this.telefono = telefono;
    }

    public Integer getTotale() {
        return totale;
    }

    public void setTotale(Integer totale) {
        this.totale = totale;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idLocation != null ? idLocation.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Location)) {
            return false;
        }
        Location other = (Location) object;
        if ((this.idLocation == null && other.idLocation != null) || (this.idLocation != null && !this.idLocation.equals(other.idLocation))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "EntityPackage.Location[ idLocation=" + idLocation + " ]";
    }

    public Collection<Prenotazione> getPrenotazioneCollection() {
        return prenotazioneCollection;
    }

    public void setPrenotazioneCollection(Collection<Prenotazione> prenotazioneCollection) {
        this.prenotazioneCollection = prenotazioneCollection;
    }
    
}
